
<%@page import="storeMovie.Util.MovieManager"%>
<%@page import="storeMovie.JavaBean.Movie"%>
<%@page import="storeMovie.JavaBean.OrderDetail"%>
<%@page import="java.util.List"%>
<%@page import="storeMovie.Util.OrderDetailManager"%>
<%@page import="java.sql.*"%><?xml version="1.0" encoding="ISO-8859-1" ?>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
	pageEncoding="ISO-8859-1"%>
<%
	String name = (String) session.getAttribute("userName");
	String ordID = request.getParameter("ordID");
	int orderId = Integer.parseInt(ordID);
	OrderDetailManager manager = new OrderDetailManager();
	List<OrderDetail> listOrderDetails = manager
			.getOrderDetailByOrderID(orderId);

	out
			.println("<h1 style='text-align: center;font-size: large;'>Order Details</h1><br/>");
	out
			.println("<h2 style='text-align: center;font-size: large;'>User Name:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"
					+ name + "</h2>");
	out
			.println("<h2 style='text-align: center;font-size: large;'>Order No:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"
					+ ordID + "</h2>");
	out
			.println("<table width=100%' border='0' cellspacing='0' cellpadding='0'>");
	out.println("<tr align='center' bgcolor='red'>");
	out.println("<td width='50%'><strong>Movie Name</strong></td>");
	out.println("<td width='20%'><strong>Movie Price</strong></td>");
	out.println("<td width='10%'><strong>Quantity</strong></td>");
	out.println("<td width='20%'><strong>Total Cost</strong></td>");
	out.println("</tr>");

	MovieManager movieManager = new MovieManager();
	for (int i = 0; i < listOrderDetails.size(); i++) {
		OrderDetail orderDetail = listOrderDetails.get(i);
		Movie movie = movieManager.getMovie(orderDetail.getMovieId());
		if (i % 2 == 0) {
			out.println("<tr  align='center'>");
		} else {
			out.println("<tr align='center' bgcolor=#efefef>");
		}
		out.println("<td><a href='#' onclick='showDetail("
				+ orderDetail.getMovieId() + ")'>"
				+ movie.getMovieName() + "</a></td>");
		out.println("<td>" + movie.getMoviePrice() + "$</td>");
		out.println("<td>" + orderDetail.getQuantity() + "</td>");
		out.println("<td>" + orderDetail.getTotalCost() + "$</td>");
	}
%>